<?php

class Config
{

    private $config = array();

    public function getConfig($name, $item = false) {
        if ($item) {
            return $this->config[$name][$item];
        } else {
            return $this->config[$name];
        }
    }

    public function includeConfig($configName, $return = false) {
        if (isset($this->config[$configName])) {
            if ($return) {
                return $this->config[$configName];
            }
            return;
        }
        if (file_exists(BASE_DIR_CONFIG . $configName . '.php')) {
            include_once BASE_DIR_CONFIG . $configName . '.php';
            if (!empty($config)) {
                $this->config[$configName] = $config;
                if ($return) {
                    return $config;
                }
                return;
            } else if ($return) {
                return false;
            }
        }
    }

}